package com.ccp.dev.qbdms.controller;

import com.alibaba.fastjson.JSON;
import com.ccp.dev.core.basic.annotion.Action;
import com.ccp.dev.core.basic.consts.UrlConstants;
import com.ccp.dev.core.basic.internationalization.SysBaseController;
import com.ccp.dev.core.basic.util.ContextUtil;
import com.ccp.dev.core.basic.web.query.QueryFilter;
import com.ccp.dev.core.poi.excel.Excel;
import com.ccp.dev.core.poi.excel.editor.IFontEditor;
import com.ccp.dev.core.poi.excel.reader.DataEntity;
import com.ccp.dev.core.poi.excel.reader.ExcelReader;
import com.ccp.dev.core.poi.excel.reader.FieldEntity;
import com.ccp.dev.core.poi.excel.reader.TableEntity;
import com.ccp.dev.core.poi.excel.style.Color;
import com.ccp.dev.core.poi.excel.style.DataFormat;
import com.ccp.dev.core.poi.excel.style.font.BoldWeight;
import com.ccp.dev.core.poi.excel.style.font.Font;
import com.ccp.dev.core.poi.excel.util.ExcelUtil;
import com.ccp.dev.core.util.BeanUtils;
import com.ccp.dev.core.util.RequestUtil;
import com.ccp.dev.core.util.StringUtil;
import com.ccp.dev.core.util.log.SysAuditThreadLocalHolder;
import com.ccp.dev.qbdms.consts.ZhiLiangConst;
import com.ccp.dev.qbdms.model.WQbdFalProblemreset;
import com.ccp.dev.qbdms.model.WQbdFalSupervise;
import com.ccp.dev.qbdms.model.WQbdXhdh;
import com.ccp.dev.qbdms.service.*;
import com.ccp.dev.qbdms.util.BaseUtil;
import com.ccp.dev.qbdms.util.ProjectUUIDUtils;
import com.ccp.dev.qbdms.util.StructureModifyUtil;
import com.ccp.dev.system.model.SysOrg;
import com.ccp.dev.system.service.DictionaryService;
import com.ccp.dev.system.service.SysOrgService;
import com.ccp.dev.system.service.SysUserService;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 型号质量问题督办 信息操作处理控制器
 *
 * @author zhl
 * @date 2020-05-07 13:41:47
 */
@Controller
/**
 * 请将此名称添加到日志开关
 */
@Action(customModel = "型号质量问题督办")
@RequestMapping("/qbdms/wQbdFalSupervise")
public class WQbdFalSuperviseController extends SysBaseController {
    @Resource
    private WQbdFalSuperviseService wQbdFalSuperviseService;

    @Resource
    private WQbdXhdhService wQbdXhdhService;

    @Resource
    private SysOrgService sysOrgService;

    @Resource
    private WCustomColumnsService wCustomColumnsService;

    @Resource
    private WQbdFalProblemresetService wQbdFalProblemresetService;

    @Resource
    private CommonalityService commonalityService;

    /**
     * 功能描述: 跳转到首页
     *
     * @return: java.lang.String
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + UrlConstants.MODULE_FUNCTION_LIST)
    @Action(description = "跳转到型号质量问题督办首页", exectype = "页面跳转日志")
    public String viewList(HttpServletRequest request, ModelMap modelMap) {
        wCustomColumnsService.addCustomCols(request);
        // 型号代号
        List<WQbdXhdh> wQbdXhdhs = wQbdXhdhService.getAll();
        modelMap.put("wQbdXhdhs", JSON.toJSONString(wQbdXhdhs));
        // 返回当前系统等级
        modelMap.put("currentSystemLevel", BaseUtil.getCurrentSystemLevel());
        // 返回当前登录人
        modelMap.put("userId", ContextUtil.getCurrentUserId());
        return "wQbdFalSupervise/list";
    }

    /**
     * 功能描述: 附带检索条件的分页查询
     *
     * @param: [request] http请求
     * @return: java.lang.Object
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping(UrlConstants.MODULE_FUNCTION_LIST)
    @ResponseBody
    @Action(description = "附带检索条件的分页查询型号质量问题督办", detail = "查询数据信息<#if success>成功<#else></#if>")
    public Object list(HttpServletRequest request) {
        QueryFilter queryFilter = new QueryFilter(request, true);
        // 创建时间倒序排序
        queryFilter.addFilter("orderField", "CREATETIME");
        queryFilter.addFilter("orderSeq", "desc");
        ZhiLiangConst.addQueryFilterNoReportStatus(queryFilter);
        //分页数据
        List<WQbdFalSupervise> pageDatas = wQbdFalSuperviseService.queryList(queryFilter);
        SysAuditThreadLocalHolder.putParamerter("success", true);
        for (WQbdFalSupervise wQbdFalSupervise : pageDatas) {
            try {
                // 台账列表中 问题责任单位
                if (StringUtil.isNotEmpty(wQbdFalSupervise.getfDutydeptId())) {
                    wQbdFalSupervise.setfDutydept(sysOrgService.getSysOrgByOrgCode(wQbdFalSupervise.getfDutydeptId()).getOrgName());
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return success(pageDatas, queryFilter.getPageBean().getTotalCount());
    }


    /**
     * 功能描述: 跳转到新增页面
     *
     * @return: java.lang.String
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + UrlConstants.MODULE_FUNCTION_ADD_UPDATE)
    @Action(description = "跳转到型号质量问题督办新增页面", exectype = "页面跳转日志")
    public String viewAdd(HttpServletRequest request, ModelMap modelMap) {
        String id = RequestUtil.getString(request, "id");
        modelMap.put("id", id);
        // 型号代号
        List<WQbdXhdh> wQbdXhdhs = wQbdXhdhService.getAll();
        modelMap.put("wQbdXhdhs", JSON.toJSONString(wQbdXhdhs));
        return "wQbdFalSupervise/add";
    }

    /**
     * 功能描述:  数据保存通用方法
     *
     * @param: wQbdFalSupervise 保存的对象
     * @return: java.lang.Object
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping(UrlConstants.MODULE_FUNCTION_SAVE)
    @ResponseBody
    @Action(description = "保存型号质量问题督办数据", detail = "<#if isAdd>新增<#else>编辑</#if>型号质量问题督办数据<#if success>成功<#else>失败</#if><#if StringUtil.isNotEmpty(modifyInfo)>${modifyInfo}</#if>")
    public Object save(@RequestBody WQbdFalSupervise wQbdFalSupervise) {
        String id = wQbdFalSupervise.getId();
        int result;
        if (StringUtil.isEmpty(id)) {
            SysAuditThreadLocalHolder.putParamerter("isAdd", true);
            wQbdFalSupervise.setId(ProjectUUIDUtils.getUUIDFor32());
            ZhiLiangConst.addCommonFields(wQbdFalSupervise);
            // 是否督办
            wQbdFalSupervise.setfIfsupervise("未下发");
            result = wQbdFalSuperviseService.add(wQbdFalSupervise);
        } else {
            SysAuditThreadLocalHolder.putParamerter("success", false);
            ZhiLiangConst.updateCommonFields(wQbdFalSupervise);
            //修改操作
            result = wQbdFalSuperviseService.update(wQbdFalSupervise);
            SysAuditThreadLocalHolder.putParamerter("modifyInfo", StructureModifyUtil.getModifyInfo(wQbdFalSuperviseService.getOneById(id), wQbdFalSupervise));
        }
        if (result > 0) {
            SysAuditThreadLocalHolder.putParamerter("success", true);
        } else {
            SysAuditThreadLocalHolder.putParamerter("success", false);
        }
        return result > 0 ? getResultDataSuccess("save.success") : getResultDataError("save.failure");
    }

    /**
     * 功能描述: 跳转到详情页面
     *
     * @return: java.lang.String
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/particulars")
    @Action(description = "跳转到型号质量问题督办详情页面", exectype = "页面跳转日志")
    public String viewParticulars(HttpServletRequest request, ModelMap modelMap) {
        String id = RequestUtil.getString(request, "id");
        modelMap.put("id", id);
        return "wQbdFalSupervise/particulars";
    }

    /**
     * 功能描述: 根据主键id获取一条数据的通用查询方法
     *
     * @param: id 参数对象必须是"id"
     * @return: java.lang.Object
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping(UrlConstants.MODULE_FUNCTION_GET)
    @ResponseBody
    @Action(description = "根据主键id查询型号质量问题督办的一条数据", detail = "根据主键id查询型号质量问题督办的数据<#if success>成功<#else>失败</#if>")
    public Object get(@RequestParam("id") String id) {
        WQbdFalSupervise wQbdFalSupervise = wQbdFalSuperviseService.getOneById(id);
        if (null == wQbdFalSupervise) {
            SysAuditThreadLocalHolder.putParamerter("success", false);
            return getResultDataError("get.failure");
        }
        SysAuditThreadLocalHolder.putParamerter("success", true);
        return getResultDataSuccess("get.success", wQbdFalSupervise);
    }

    /**
     * 功能描述: 根据主键ID删除数据的通用删除方法
     *
     * @param: id 参数名称必须是"id"
     * @return: java.lang.Object
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @PostMapping(UrlConstants.MODULE_FUNCTION_DELETE)
    @ResponseBody
    @Action(description = "根据主键ID删除型号质量问题督办数据", exectype = "删除日志", detail = "删除数据信息<#if success>成功<#else>失败</#if>")
    public Object delete(@RequestParam("id") String id) {
        if (StringUtil.isEmpty(id)) {
            SysAuditThreadLocalHolder.putParamerter("success", false);
            return fail("delete.failure.message");
        }
        int result = 0;
        String[] split = id.split(",");
        for (String idm : split) {
            WQbdFalSupervise qbdFalSupervise = wQbdFalSuperviseService.getOneById(idm);
            if ("下发成功".equals(qbdFalSupervise.getfIfsupervise())) {
                return fail("您所选的内容包含下发成功，请重新选择！");
            }
            if ("下发中".equals(qbdFalSupervise.getfIfsupervise())) {
                return fail("您所选的内容包含下发中，请重新选择！");
            }
            if (!qbdFalSupervise.getCreateBy().equals(ContextUtil.getCurrentUserId())){
                return fail("只能删除自己创建的数据！");
            }
        }
        result = wQbdFalSuperviseService.delByIdArray(id.split(","));
        if (result > 0) {
            SysAuditThreadLocalHolder.putParamerter("success", true);
        } else {
            SysAuditThreadLocalHolder.putParamerter("success", false);
        }
        return result > 0 ? getResultDataSuccess("delete.success") : getResultDataError("delete.failure");
    }

    /**
     * 功能描述: 跳转到导入页面
     *
     * @return: java.lang.String
     * @auther: hw
     * @date: 2019-12-25 19:21:40
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/import")
    @Action(description = "跳转到型号质量问题督办导入页面", exectype = "页面跳转日志")
    public String viewImport() {
        return "wQbdFalSupervise/import";
    }

    /**
     * 功能描述: 导出型号质量问题督办数据信息
     *
     * @param: [request] http请求
     * @return: java.lang.Object
     * @auther: zhl
     * @date: 2020-05-07 13:41:47
     */
    @RequestMapping("/exportData")
    @Action(description = "导出型号质量问题督办数据信息", detail = "导出型号质量问题督办数据信息<#if success>成功<#else></#if>")
    public void export(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String[] id = RequestUtil.getStringAryByStr(request, "id");
        QueryFilter queryFilter = new QueryFilter(request, false);
        if (BeanUtils.isNotEmpty(id) && id.length != 0) {
            queryFilter.put("byId", true);
            queryFilter.put("id", id);
        } else {
            queryFilter.put("byId", false);
        }
        SysAuditThreadLocalHolder.putParamerter("success", true);
        Excel excel = new Excel();
        //导出的文件名称
        String fileName = "WQbdFalSupervise";
        // 重命名当前处于工作状态的表的名称
        excel.sheet().sheetName("sheet");
        List<String> titleList = new ArrayList<>();
        titleList.add("主键");
        titleList.add("填写人");
        titleList.add("填写人的账号");
        titleList.add("填写部门");
        titleList.add("填写部门id");
        titleList.add("填写日期");
        titleList.add("密级");
        titleList.add("型号名称");
        titleList.add("型号代号");
        titleList.add("问题责任单位");
        titleList.add("问题责任单位id");
        titleList.add("问题现象");
        titleList.add("是否督办");
        titleList.add("是否归零");
        titleList.add("质量问题id");
        titleList.add("F_REPORT_STATUS");
        titleList.add("是否集团下发");
        titleList.add("数据来源单位");
        titleList.add("租户Id");
        titleList.add("创建人");
        titleList.add("创建时间");
        titleList.add("更新人");
        titleList.add("更新时间");
        excel.row(0, 0).value(titleList.toArray());
        excel.row(0, 0).font(new IFontEditor() {
            // 设置字体
            @Override
            public void updateFont(Font font) {
                font.boldweight(BoldWeight.BOLD);// 粗体
            }
        }).bgColor(Color.GREY_25_PERCENT).width(3500);
        excel.row(0, 1).width(3500);
        excel.row(0, 2).width(3500);
        excel.row(0, 3).width(3500);
        excel.row(0, 4).width(3500);
        //设置列的数据格式
        excel.sheet().setDefaultColumnStyle(0, DataFormat.TEXT);
        excel.sheet().setDefaultColumnStyle(1, DataFormat.TEXT);
        excel.sheet().setDefaultColumnStyle(2, DataFormat.TEXT);
        excel.sheet().setDefaultColumnStyle(3, DataFormat.TEXT);
        ExcelUtil.downloadExcel(wQbdFalSuperviseService.exportExcel(excel, queryFilter), fileName, response);
    }

    /**
     * 导入资源文件
     *
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("/importData")
    public void importData(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception {
        MultipartFile multipartFile = request.getFile("file");
        PrintWriter writer = response.getWriter();
        try {
            String fileName = multipartFile.getOriginalFilename();
            String extName = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
            //读取excel文件，并获取每行的数据
            ExcelReader excelReader = new ExcelReader();
            TableEntity excelEntity = excelReader.readFile(multipartFile.getInputStream());
            List<DataEntity> rowDataEntityList = excelEntity.getDataEntityList();

            List<WQbdFalSupervise> listToInsert = new ArrayList<>();
            for (DataEntity dataEntity : rowDataEntityList) {
                //获取每列的数据
                List<FieldEntity> fieldEntityList = dataEntity.getFieldEntityList();
                WQbdFalSupervise dataToInsert = new WQbdFalSupervise();
                int i = 0;
                //根据列的顺序，给相应的对象赋值
                for (FieldEntity fieldEntity : fieldEntityList) {
                    //if(i==0){
                    //dataToInsert.setName(fieldEntity.getValue());
                    //}
                    i++;
                }
                dataToInsert.setId(ProjectUUIDUtils.getUUIDFor32());
                listToInsert.add(dataToInsert);
            }
            wQbdFalSuperviseService.addList(listToInsert);
            SysAuditThreadLocalHolder.putParamerter("success", true);
            JSONObject json = JSONObject.fromObject(getResultDataSuccess("operation.success"));
            writer.print(new String(json.toString().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
        } catch (Exception e) {
            SysAuditThreadLocalHolder.putParamerter("success", false);
            JSONObject json = JSONObject.fromObject(getResultDataError("operation.failure"));
            writer.print(new String(json.toString().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
        }
    }

    /**
     * 督办
     */
    @RequestMapping("/suEdit")
    @Action(description = "督办", detail = "督办<#if fl>成功<#else>失败</#if>(W_QBD_FAL_SUPERVISE)")
    @ResponseBody
    public String suEdit(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String[] lAryId = RequestUtil.getStringAryByStr(request, "ids");
        String message = "";
        String message2 = "";
        int judge = 0;
        // 获取当前系统级别
        BaseUtil.SystemLevel currentSystemLevel = BaseUtil.getCurrentSystemLevel();
        // 院级 单位下发需要获取参数
        String dbDept = RequestUtil.getString(request, "dbDept");
        String dbDeptId = RequestUtil.getString(request, "dbDeptId");
        if (lAryId != null && lAryId.length > 0) {
            // 检测多条数据id是否为督办状态
            List<WQbdFalSupervise> qbdFalSuperviseList = wQbdFalSuperviseService.getByIds(lAryId);
            // 用来批量下发
            for (WQbdFalSupervise qbdFalSupervise : qbdFalSuperviseList) {
                if ("下发成功".equals(qbdFalSupervise.getfIfsupervise())) {
                    message2 = "所选信息包含已督办，请勿重复操作！";
                } else if("下发中".equals(qbdFalSupervise.getfIfsupervise())){
                    message2 = "所选信息包含下发中，请勿重复操作！";
                } else {
                    // -- 状态先改为下发中
                    qbdFalSupervise.setfIfsupervise("下发中");
                    wQbdFalSuperviseService.update(qbdFalSupervise);

                    if("HOSPITALLEVEL".equals(currentSystemLevel.toString())){
                        // 选择器选择的单位 和id 赋值给
                        SysOrg sysOrgById = sysOrgService.getSysOrgById(dbDeptId);
                        qbdFalSupervise.setfDutydept(dbDept);
                        qbdFalSupervise.setfDutydeptId(sysOrgById.getCode());
                    }
                    // 接口调用 将数据下发给 下级组织 状态是未下发 和 下发失败
                    judge += judge(qbdFalSupervise);
                }
            }
        }
        if (judge > 0) {
            message = "成功督办" + judge + "条数据";
        } else {
            message = message2 + "督办失败";
        }
        return message;
    }

    /**
     * 判断部署方式 来 选择 更新当前数据 还是下发当前数据
     */
    public int judge(WQbdFalSupervise wQbdFalSupervise){
        int result = 0;
        try{
            // 判断当前系统是否集中部署  是 true 否 false
            boolean isCentralizedDeployment = ZhiLiangConst.isCentralizedDeployment(wQbdFalSupervise.getfDutydeptId());
            boolean isSuccess = false;
            if(!isCentralizedDeployment){
                // 分级部署需要调用接口
                isSuccess = commonalityService.issue("wQbdFalSupervise", wQbdFalSupervise,wQbdFalSupervise.getfDutydeptId());
            } else {
                // 集中部署下发需要 改变 Belongdeptname
                wQbdFalSupervise.setBelongdeptname(BaseUtil.getTenOrgCodePath(wQbdFalSupervise.getfDutydeptId()));
            }
            // 下发成功后更新本地， 或者是 集中部署更新本地
            wQbdFalSupervise.setfIfsupervise("下发成功");
            result = 1;
            if(!isSuccess && !isCentralizedDeployment){
                wQbdFalSupervise.setfIfsupervise("下发失败");
                // 调用接口下发失败
                result = 0;
            }
            wQbdFalSuperviseService.update(wQbdFalSupervise);
        } catch (Exception e){
            wQbdFalSupervise.setfIfsupervise("下发失败");
            wQbdFalSuperviseService.update(wQbdFalSupervise);
            e.printStackTrace();
            return result;
        }
        return result;
    }


    /**
     * 关联质量问题页面
     *
     * @param request
     * @param modelMap
     * @return
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/relation")
    @Action(description = "跳转到质量问题管理关联页面", exectype = "页面跳转日志")
    public String relation(HttpServletRequest request, ModelMap modelMap) {
        String did = RequestUtil.getString(request, "did");
        modelMap.put("did", did);
        return "wQbdFalSupervise/relation";
    }

    /**
     * 显示已关联的质量问题
     *
     * @param request
     * @param modelMap
     * @return
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/associated")
    @Action(description = "跳转到关联的质量问题页面", exectype = "页面跳转日志")
    public String associated(HttpServletRequest request, ModelMap modelMap) {
        String did = RequestUtil.getString(request, "did");
        modelMap.put("did", did);
        return "wQbdFalSupervise/associated";
    }

    /**
     * 跟踪列表页
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/track")
    @Action(description = "跳转到质量问题管理跟踪页面", exectype = "页面跳转日志")
    public String track(HttpServletRequest request, ModelMap modelMap) {
        String did = RequestUtil.getString(request, "did");
        modelMap.put("did", did);
        return "wQbdFalSupervise/track";
    }


    /**
     * 督办关联质量信息
     */
    @RequestMapping("associations")
    @Action(description = "督办关联质量信息", detail = "督办关联<#if fl>成功<#else>失败</#if>(W_QBD_FAL_SUPERVISE)")
    @ResponseBody
    public Object associations(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String[] lAryId = RequestUtil.getStringAryByStr(request, "ids");
        String did = RequestUtil.getString(request, "did");
        HashMap<String, Object> map = new HashMap<>(2);
        if (lAryId.length > 0) {
            // 先检查所选id 是否已经关联过督办
            List<WQbdFalProblemreset> wQbdFalProblemresets = wQbdFalProblemresetService.getByIds(lAryId);
            for (WQbdFalProblemreset problemreset : wQbdFalProblemresets) {
                if (StringUtil.isNotEmpty(problemreset.getfSuperviseid())) {
                    // 如果已经关联过，则不能再次关联
                    map.put("message", "关联失败，请重新刷新浏览器!");
                    return map;
                }
            }
            // 用来批量关联 质量信息id
            map.put("ids", lAryId);
            // 督办id
            map.put("did", did);
            wQbdFalProblemresetService.associations(map);
            map.put("message", "关联成功!");
        } else {
            map.put("message", "关联失败，请重新刷新浏览器!");
        }

        return map;

    }

    /**
     * 取消关联质量信息
     *
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping("associated")
    @Action(description = "取消关联质量信息", detail = "取消关联<#if fl>成功<#else>失败</#if>(W_QBD_FAL_SUPERVISE)")
    @ResponseBody
    public Object associated(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String[] lAryId = RequestUtil.getStringAryByStr(request, "ids");
//        String did = RequestUtil.getString(request, "did");
        HashMap<String, Object> map = new HashMap<>(2);
        if (lAryId.length > 0) {
            // 先检查所选id 是否未关联
            List<WQbdFalProblemreset> wQbdFalProblemresets = wQbdFalProblemresetService.getByIds(lAryId);
            for (WQbdFalProblemreset problemreset : wQbdFalProblemresets) {
                if (StringUtil.isEmpty(problemreset.getfSuperviseid())) {
                    // 没有关联，则不能取消关联
                    map.put("message", "所选数据还没有关联，请重新刷新浏览器!");
                    return map;
                }
            }
            // 用来批量关联 质量信息id
            map.put("ids", lAryId);
            map.put("fSuperviseid", "");
            // 督办id
            // map.put("did",did);
            wQbdFalProblemresetService.associations(map);
            map.put("message", "已取消关联!");
        } else {
            map.put("message", "数据异常，请重新刷新浏览器!");
        }
        return map;
    }


}
